package models

import "gvb_server/models/ctype"

type ArticleModel struct {
	Model
	Title         string         `gorm:"type:varchar(255);not null;comment:标题" json:"title"`
	Content       string         `gorm:"type:text;not null;comment:内容" json:"content"`
	Author        string         `gorm:"type:varchar(255);not null;comment:作者" json:"author"`
	Category      string         `gorm:"type:varchar(255);not null;comment:分类" json:"category"`
	Status        int            `gorm:"type:int(11);not null;comment:状态" json:"status"`
	UserModel     UserModel      `gorm:"foreignkey:UserID" json:"_"`
	UserID        int            `gorm:"type:int(11);not null;comment:用户ID" json:"user_id"`
	Tags          ctype.Array    `gorm:"type:varchar(255);not null;comment:标签"`
	BannerModel   BannerModel    `gorm:"foreignkey:BannerID" json:"_"`
	BannerID      int            `gorm:"type:int(11);not null;comment:轮播图ID" json:"banner_id"`
	TagModels     []TagModel     `gorm:"many2many:article_tag_models" json:"tag_models"`
	ArticleModels []ArticleModel `gorm:"foreignkey:UserID" json:"_"`
	CommentModels []CommentModel `gorm:"foreignkey:ArticleID" json:"_"`
}
